package chapter4.No4_1_使用reentrantLock类.demo11;

/**
 * *：公平锁和非公平锁
 *    公平锁：是按照线程加锁的顺序来分配的，即先到先得的FIFO先进先出顺序。(chapter1.Main)
 *    非公平锁：获取锁的抢占机制，是随机获取锁的。(Main_2)
 * Created by Administrator on 2016/11/21.
 */
public class Main {

    public static void main(String[] args) {
        Service service = new Service(true);
        ThreadA[] as = new ThreadA[10];

        for(int i = 0; i < 10; i++) {
            as[i] = new ThreadA(service);
        }

        for(ThreadA a : as) {
            a.start();
        }
    }
}
